Clover coverage report - Enterprise Web Services - 1.0
Coverage timestamp: Mon May 30 2005 17:10:32 CEST
file stats: LOC: 106   Methods: 3
NCLOC: 67   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
Ws4J2EEClientwithWSDL.java 50% 81.8% 100% 80%
coverage coverage
 1   
 /*
 2   
  * Copyright 2001-2004 The Apache Software Foundation.
 3   
  * 
 4   
  * Licensed under the Apache License, Version 2.0 (the "License");
 5   
  * you may not use this file except in compliance with the License.
 6   
  * You may obtain a copy of the License at
 7   
  * 
 8   
  *      http://www.apache.org/licenses/LICENSE-2.0
 9   
  * 
 10   
  * Unless required by applicable law or agreed to in writing, software
 11   
  * distributed under the License is distributed on an "AS IS" BASIS,
 12   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13   
  * See the License for the specific language governing permissions and
 14   
  * limitations under the License.
 15   
  */
 16   
 
 17   
 package org.apache.geronimo.ews.ws4j2ee.toWs;
 18   
 
 19   
 import org.apache.commons.logging.Log;
 20   
 import org.apache.commons.logging.LogFactory;
 21   
 import org.apache.geronimo.ews.ws4j2ee.context.ContextValidator;
 22   
 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
 23   
 import org.apache.geronimo.ews.ws4j2ee.context.MiscInfo;
 24   
 import org.apache.geronimo.ews.ws4j2ee.context.webservices.client.interfaces.ServiceReferanceContext;
 25   
 import org.apache.geronimo.ews.ws4j2ee.toWs.impl.Ws4J2eeFactoryImpl;
 26   
 import org.apache.geronimo.ews.ws4j2ee.utils.MiscFactory;
 27   
 import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
 28   
 
 29   
 import java.io.FileInputStream;
 30   
 import java.util.HashMap;
 31   
 
 32   
 /**
 33   
  * <p>this class genarate the code when the WSDL presents.</p>
 34   
  */
 35   
 public class Ws4J2EEClientwithWSDL implements Generator {
 36   
     private String wsConfFileLocation;
 37   
     private boolean verbose = false;
 38   
     private Ws4J2eeCLOptionParser clparser;
 39   
     private Ws4J2eeFactory factory;
 40   
     protected static Log log =
 41   
             LogFactory.getLog(Ws4J2EEClientwithWSDL.class.getName());
 42   
 
 43   
     private MiscInfo misc;
 44   
 
 45  4
     public Ws4J2EEClientwithWSDL(String[] args) throws Exception {
 46  4
         clparser = new Ws4J2eeCLOptionParser(args);
 47   
     }
 48   
 
 49   
     /**
 50   
      * genarate. what is genarated is depend on genarators included.
 51   
      *
 52   
      * @see org.apache.geronimo.ews.ws4j2ee.toWs.Generator#genarate()
 53   
      */
 54  4
     public void generate() throws GenerationFault {
 55  4
         try {
 56  4
             factory = new Ws4J2eeFactoryImpl();
 57  4
             J2EEWebServiceContext wscontext = factory.getContextFactory().getJ2EEWsContext(true);
 58  4
             wscontext.setFactory(factory);
 59   
 
 60  4
             misc = factory.getContextFactory().createMiscInfo(new HashMap());
 61  4
             wscontext.setMiscInfo(misc);
 62  4
             String wscfClientfile = clparser.getWscffile();
 63  4
             misc.setWsconffile(MiscFactory.getInputFile(wscfClientfile));
 64  4
             misc.setOutputPath(clparser.getOutputDirectory());
 65  4
             wsConfFileLocation = Utils.getRootDirOfFile(wscfClientfile);
 66  4
             wscontext.getMiscInfo().setImplStyle(clparser.getImplStyle());
 67  4
             wscontext.getMiscInfo().setTargetJ2EEContainer(clparser.getContanier());
 68   
             
 69   
             
 70   
             //parsing of the webservices.xml happen here 
 71  4
             ServiceReferanceContext serviceContext =
 72   
                     factory.getParserFactory().parseServiceReferance(wscontext,
 73   
                             new FileInputStream(wscfClientfile));
 74  4
             if (verbose) {
 75  0
                 log.info(wscfClientfile + " parsed ..");
 76  0
                 log.info(serviceContext.getJaxrpcmappingFile());
 77  0
                 log.info(serviceContext.getWsdlFile());
 78   
             }
 79  4
             wscontext.getMiscInfo().setJaxrpcfile(MiscFactory.getInputFile(Utils.getAbsolutePath(serviceContext.getJaxrpcmappingFile(),
 80   
                     wsConfFileLocation)));
 81  4
             wscontext.getMiscInfo().setWsdlFile(MiscFactory.getInputFile(Utils.getAbsolutePath(serviceContext.getWsdlFile(),
 82   
                     wsConfFileLocation)));
 83  4
             wscontext.getMiscInfo().setVerbose(verbose);
 84  4
             wscontext.getMiscInfo().setHandlers(serviceContext.getHandlers()); 
 85   
             
 86   
             //JAX-RPC mapper calling
 87  4
             if (verbose)
 88  0
                 log.info("starting client side code genaration .. ");
 89  4
             Generator clientStubGen = factory.getGenerationFactory().createClientSideWsGenerator(wscontext);
 90  4
             clientStubGen.generate();
 91  4
             ContextValidator cvalidator = new ContextValidator(wscontext);
 92   
             //cvalidator.validateWithWSDL();
 93  4
             Generator handlerGen = factory.getGenerationFactory().createHandlerGenerator(wscontext);
 94  4
             handlerGen.generate();
 95   
         } catch (Exception e) {
 96  0
             e.printStackTrace();
 97  0
             throw GenerationFault.createGenerationFault(e);
 98   
         }
 99   
     }
 100   
 
 101  4
     public static void main(String[] args) throws Exception {
 102  4
         Ws4J2EEClientwithWSDL gen = new Ws4J2EEClientwithWSDL(args);
 103  4
         gen.generate();
 104   
     }
 105   
 }
 106